home *** CD-ROM | disk | FTP | other *** search
/ Aminet 50 / Aminet 50 (2002)(GTI - Schatztruhe)[!][Aug 2002].iso / Aminet / text / edit / tecoc-146.lha / echoit.c < prev    next >
C/C++ Source or Header  |  1991-07-05  |  1KB  |  63 lines

  1. /*****************************************************************************
  2.  
  3.     EchoIt()
  4.  
  5.     This function displays a character in it's printable form, either
  6. as CH, ^CH, or [CH].
  7.  
  8. *****************************************************************************/
  9.  
  10. #include "zport.h"        /* define portability identifiers */
  11. #include "tecoc.h"        /* define general identifiers */
  12. #include "defext.h"        /* define external global identifiers */
  13. #include "dchars.h"        /* define identifiers for characters */
  14.  
  15. VVOID EchoIt(Charac)
  16. unsigned char Charac;
  17. {
  18.     if (Charac > USCHAR && Charac < DELETE) {    /* displayable? */
  19.         ZDspCh(Charac);
  20.     } else if (Charac & '\200') {            /* eighth bit set? */
  21.         if (EtFlag & ET_EIGHTBIT) {        /* term can display */
  22.             ZDspCh(Charac);
  23.         } else {
  24.             ZDspCh('[');            /* display as [ch] */
  25.             MakDBf((LONG)Charac,16);
  26.             *DBfPtr++ = ']';
  27.             ZDspBf(DBfBeg, DBfPtr-DBfBeg);
  28.         }
  29.     } else {
  30.         switch (Charac) {
  31.         case BAKSPC:
  32.         case TABCHR:
  33.         case LINEFD:
  34.         case CRETRN:
  35.             ZDspCh(Charac);
  36.             break;
  37.  
  38.         case ESCAPE:
  39.             ZDspCh('$');
  40.             break;
  41.  
  42.         case FORMFD:
  43.             ZDspCh('\r');
  44.             /* fall through to VRTTAB */
  45.  
  46.         case VRTTAB:
  47.             ZDspBf("\n\n\n\n", 4);
  48.             break;
  49.  
  50.         case DELETE:
  51.             break;
  52.  
  53.         case CTRL_G:
  54.             ZDspCh(CTRL_G);
  55.             /* fall through to default case */
  56.  
  57.         default:                /* display as ^ch */
  58.             ZDspCh('^');
  59.             ZDspCh(Charac | '\100');
  60.         }
  61.     }
  62. }
  63.